package com.pactera.madp.cp.api.em.beta;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.Assert;

/**
 * @title 精编资讯类型定义
 * @date 2022-06-10
 * @author Deming.Chang
 */
@Getter
@AllArgsConstructor
public enum ChoreographyEnum {
    NEWS_NOON(1, "午报"),                   // 资讯陪伴-午报
    FUND(2, "基金"),
    NEWS_CLOSING_COMMENTS(3, "收盘点评"),   // 资讯陪伴-收盘点评
    NEWS_EVENING(4, " 晚报"),              // 资讯陪伴-晚报
    INSURANCE(5, "保险"),
    PROPERTY(6, "房产"),
    FINANCIAL(7, "理财"),
    MACRO(8, "宏观"),
    INTERNATIONAL(9, "国际市场"),
    SECURITIES(10, "证券"),
    PRIVATE(11, "私募"),
    FAMILY(12, "家族财富"),
    TAX_SMALL(13, " 税筹/小微"),
    NEWS_MORNING(14, "早报");             // 资讯陪伴-早报

    private Integer type;    // 类型
    private String name;    // 名称

    /**
     * 根据类型数值获取枚举对象
     * @param type    精编资讯类型值
     * @return
     */
    public static ChoreographyEnum findByType(Integer type){
        Assert.notNull(type, "精编资讯类型值不能为空!");
        for(ChoreographyEnum enums: values()){
            if(enums.type == type){
                return enums;
            }
        }
        throw new IllegalArgumentException("参数异常,参数值不在允许的值范围之内!");
    }
}
